# encoding: utf-8
__author__ = 'wwj'
import socket
def getip(ip):
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(('8.8.8.8', 80))
        lip = s.getsockname()[0]
    finally:
        s.close()
    return "localhost" if lip == ip else ip

hongkongMysql = {
    'ip': getip('47.75.39.50'),
    'pwd' : 'sds...WW22!!eeee',
    'mysqlUser' : 'xiaolei',
    'mysqlPwd' : 'ken402402',
}

hongkongMongo = {
    'mongoIp':getip('47.75.39.50'),
    'pwd' : 'sds...WW22!!eeee',
    'mongoUser' : 'admin321',
    'mongoPwd' : 'dsf::6666,,<<',
}

jpMongo = {
    'mongoIp':getip('47.74.21.140'),
    'pwd' : 'sds...WW22!!eeee',
    'mongoUser' : 'admin321',
    'mongoPwd' : 'dsf::6666,,<<',
}


city = {
    "from": jpMongo,
    'mongoDb' : 'city',
    'release' : hongkongMysql,
    'mysqlDb' : 'shantianjunbak',
}


xcity = {
    "from": jpMongo,
    'mongoDb' : 'city',
    'release' : hongkongMysql,
    'mysqlDb' : 'shantianjunbak',
}



newcity = {
    "from": hongkongMongo,
    'mongoDb' : 'city',
    'release' : hongkongMysql,
    'mysqlDb' : 'shantianjunbak',
}


agenda = {
    "from": jpMongo,
    'mongoDb' : 'city',
    'release' : hongkongMysql,
    'mysqlDb' : 'shantianjunbak',
}

dmmimg = {
    "from": jpMongo,
    'mongoDb' : 'dmm2',
    'release' : hongkongMysql,
    'mysqlDb' : 'shantianjunbak',
}

dmm = {
    "from": jpMongo,
    'mongoDb' : 'dmm',
    'release' : hongkongMysql,
    'mysqlDb' : 'shantianjunbak',
}

xvideo = {
    "from": jpMongo,
    'mongoDb' : 'xvideo',
    'release' : hongkongMysql,
    'mysqlDb' : 'shantianjunbak',
}


xp = {
    "from": jpMongo,
    'mongoDb' : 'xp',
    'release' : hongkongMysql,
    'mysqlDb' : 'shantianjunbak',
}

class myException(Exception):
    pass